home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / util / 4dtechno.sit / Flush Info < prev   
Text File  |  1987-08-09  |  3KB  |  51 lines

  1. The FLUSH Variable        1
  2.  
  3.  
  4. Flush Info
  5.  
  6. This is a draft of a tech note about setting the FLUSH equal to zero to speed up the importation of data.  Setting the FLUSH to zero is a way of overriding 4D's conservative approach to saving to disk all the time and letting the Macintosh decided when the buffer is full.
  7.  
  8. There is a system variable called FLUSH that can be used to speed up several
  9. operations in 4th Dimension.  FLUSH is a potentially dangerous variable, that
  10. must be used only if it is absolutely neccessary.  All operations that save
  11. data (ADD RECORD, APPLY TO SELECTION, DELETE DOCUMENT, DELETE RECORD, DELETE SELECTION, IMPORT DIF, IMPORT SYLK, IMPORT TEXT, MODIFY RECORD, MODIFY SELECTION, SAVE LINKED RECORD, SAVE OLD LINKED RECORD, SAVE RECORD, SAVE SET, SAVE VARIABLE) use this variable.
  12.  
  13. The default setting of FLUSH is 1. With this setting, when a save is performed, the descriptive information about the volume, the contents of the volume buffer and all associated access path buffers are written out.
  14.  
  15. You can set FLUSH to zero before doing a series of saves.  By doing this, every time a save is performed, all the information is NOT written to the volume.  This speeds up each save considerably.
  16.  
  17. IT IS EXTREMELY IMPORTANT THAT YOU RESET FLUSH TO 1 AFTER YOU ARE DONE.  This will update all the information on the volume.
  18.  
  19. Typically, when you are in importing records:
  20.  
  21.    DEFAULT FILE([Employees])
  22.    SET CHANNEL(13;"")
  23.    IF (OK=1)
  24.        fldDelimit:=206
  25.            ' system variable for field delimiter
  26.        rcdDelimit:=207
  27.            ' system variable for record delimiter
  28.        INPUT LAYOUT("emp.import")
  29.        flush:=O
  30.            ' This will stop flushing for every record that is received.
  31.        While(OK=1)
  32.            ERASE WINDOW
  33.            CREATE RECORD
  34.            RECEIVE RECORD
  35.            IF(OK=1)
  36.                MESSAGE("Receiving record....."+String([employees]EmployeeNo))
  37.                 SAVE RECORD
  38.             End if
  39.         End while
  40.         flush:=1
  41.             ' This will update all the received records.
  42.         End if
  43.         SET CHANNEL(11)
  44.  
  45. Set FLUSH to O before starting the While loop for receiving records.  This will
  46. speed up the SAVE RECORD command.  When all the records are received, set FLUSHback to 1.  This will update all the information of the saved records.
  47.  
  48. IMPORTANT: If there is an interruption, such as a power failure, while FLUSH is O, then all data entered since FLUSH was set to O will be lost.  This can also damage the database and you will have to run 4th Dimension Utilities to repair it.
  49.  
  50. THE DECISION TO USE FLUSH SHOULD ENTIRELY BE BASED ON HOW FREQUENTLY YOU NEED TO UPDATE THE VOLUME WHEN SAVING RECORDS.  REMEMBER, USE FLUSH WITH CARE.  IT IS BETTER TO BE SLOWER THEN TO LOSE DATA.
  51.